﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;


namespace bankos
{
    class BankModel
    {
        public int allMoney = 1000;
        public void login(string cardNUm, string pin)//kártya szám megegyezik az pinkódadl utcsó négy
        {
            if (cardNUm.Length < 4)
            {
                MessageBox.Show("The card number false");
            }
            else
            {
                string chechker = "";
                for (int i = 4; i > 1; i--)
                {
                    chechker += cardNUm[cardNUm.Length - i];

                }
                if (chechker.CompareTo(pin)==-1 && pin.Length==4)
                {
                    
                    MessageBox.Show("Pin is good");
                    DollarChoice a = new DollarChoice();
                    a.Show();
                }
                else
                {
                    MessageBox.Show("Pin is wrong");
                }
            }



        }
        public bool getMoney(int dollar)
        {
            bool van = false;
            if (allMoney - dollar >= 0)
            {
                van = true; 
            }
            return van;
 
        }
        public int takeMoney(int dollar)
        {
            return allMoney - dollar;
        }

    }
}
